# Maintainer: Torsten Keßler <tpkessler at archlinux dot org>

pkgname="intel-oneapi-dpcpp-cpp"
pkgver='2023.0.0'
_debpkgrel='25370'
pkgrel=2
pkgdesc="Intel oneAPI DPC++/C++ Compiler"
arch=('loong64' 'x86_64')
url='https://software.intel.com/content/www/us/en/develop/tools/oneapi.html'
license=("custom")
source=("https://apt.repos.intel.com/oneapi/pool/main/${pkgname}-${pkgver}-${pkgver}-${_debpkgrel}_amd64.deb")
b2sums=('76772d689cd22c9f7a33df400887b639e928326aa426dc8be15990bf4a76cfc089b28e57da9f855923ddb76816fb9693e24549a9d4ff5732af6a50d73253a431')
noextract=(
    "${pkgname}-${pkgver}-${pkgver}-${_debpkgrel}_amd64.deb"
)
depends=('intel-oneapi-compiler-dpcpp-cpp-common' 'intel-oneapi-compiler-dpcpp-cpp-runtime'
         'intel-oneapi-compiler-shared-runtime' 'intel-oneapi-compiler-shared'
         'intel-oneapi-tbb' 'intel-oneapi-dev-utilities' 'intel-oneapi-common')
conflicts=('intel-oneapi-basekit')

package() {
    cd "${srcdir}"
    ar x "${srcdir}/${pkgname}-${pkgver}-${pkgver}-${_debpkgrel}_amd64.deb"
    tar xvf data.tar.xz -C "${pkgdir}"
    rm data.tar.xz

    # allow libs to be found
    local _lib_path='/opt/intel/oneapi/compiler'
    local _ldso_conf="${pkgdir}"/etc/ld.so.conf.d
    install -d "${_ldso_conf}"
    echo "${_lib_path}/latest/linux/lib" > "${_ldso_conf}/${pkgname}.conf"
    echo "${_lib_path}/latest/linux/lib/x64" >> "${_ldso_conf}/${pkgname}.conf"

    install -d "${pkgdir}"/usr/share/licenses/"${pkgname}"
    ln -s /usr/share/licenses/intel-oneapi "${pkgdir}"/usr/share/licenses/"${pkgname}"/oneapi
}
